var read = require('hy5b/backend/path-read');
var t = require('hy5b/t');

var write = require('hy5b/backend/write');

require('colors')

var balance = []

var liabilityAndEquity = [];

var notice = {}

read('../godie/conf/current_asset.json', function(err, str, file) {
  if (err) {
    console.log(err);
    return;
  }
  var option = JSON.parse(str);

  option.prop.forEach(function(param) {
    balance.push({
      id: param,
      show: option.param[param].split("|")[1]
    })
  })
  notice.non_current_asset();
})

read('../godie/conf/current_liability.json', function(err, str, file) {
  if (err) {
    console.log(err);
    return;
  }
  var option = JSON.parse(str);

  option.prop.forEach(function(param) {
    liabilityAndEquity.push({
      id: param,
      show: option.param[param].split("|")[1]
    })
  })
  notice.non_current_liability();
})

notice.non_current_asset = function() {
  read('../godie/conf/non_current_asset.json', function(err, str, file) {
    var option = JSON.parse(str);

    option.prop.forEach(function(param) {
      balance.push({
        id: param,
        show: option.param[param].split("|")[1]
      })
    })
    notice.asset();
  })
}

notice.non_current_liability = function() {
  read('../godie/conf/non_current_liability.json', function(err, str, file) {
    var option = JSON.parse(str);

    option.prop.forEach(function(param) {
      liabilityAndEquity.push({
        id: param,
        show: option.param[param].split("|")[1]
      })
    })
    notice.owner_equity();
  })
}

notice.owner_equity = function() {
  read('../godie/conf/owner_equity.json', function(err, str, file) {
    var option = JSON.parse(str);

    option.prop.forEach(function(param) {
      liabilityAndEquity.push({
        id: param,
        show: option.param[param].split("|")[1]
      })
    })
    notice.liabilityAndEquity();
  })
}

notice.asset = function() {
  console.log(balance)
}

notice.liabilityAndEquity = function() {
  console.log(liabilityAndEquity)
}
